/*
 * Created on 2005-11-7
 *
 */
package cn.com.pxto.dao.pagesupport.hibernate;
/**
 * @author Gauss Chueng
 *
 */
import net.sf.hibernate.SessionFactory;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.orm.hibernate.support.HibernateDaoSupport;


public class HibernatePageDaoSupport extends HibernateDaoSupport {
	private static Log log = LogFactory.getLog(HibernatePageDaoSupport.class);
    private HibernatePageTemplate template;

    //paged template factory
    public final HibernatePageTemplate getTemplate(){
    	if (template==null){
    		SessionFactory sessionFactory = getSessionFactory();
    		template=new HibernatePageTemplate(sessionFactory);
    	}
    	if (log.isDebugEnabled())
    	log.debug(this.getClass().getName()+" use a PageTemplate:"+template);
    	return template;
    }
    
}
